package com.aim.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

import android.util.Log;

public class PT {
 public static void PT() {

	   Log.e("sspt", "asssspt");
   String u = "http://demoapps.nobelsystems.net/aim/odata.svc/CreateNewCase";
   String p = "";
//	   "userName='z'&encPassword=''&salt=''&howmanyPicture=''&carMake=''&carModel=''&carColor=''&carType=''&vin=''&address=''&towreason=''&mileage=''&licensePlate=''";
   //	 String u = " http://demoapps.nobelsystems.net/aim/odata.svc/GetUser?tenant='JCIA'&username='ashish'&password='nobel123'&imei='32323'";
	 try   { 
	   URL   url   =   new   URL( u); 
	   HttpURLConnection   connection   =   (HttpURLConnection)url.openConnection(); 
	   connection.setDoOutput(true);
	   connection.setDoInput(true);
	   connection.setRequestMethod("POST");
	   connection.setRequestProperty("Content-Type","text/*");
	   
	   connection.connect();
//	   connection.getHeaderField(1);
//	   System.out.println(connection.getContentType());
	   OutputStreamWriter   out   =   new   OutputStreamWriter(connection.getOutputStream(),  "unicode"); 
	   out.write(p);
	   out.flush(); 
	   out.close(); 
	   Log.e("spt2", "s2");
	   BufferedReader in = new BufferedReader(
			   new InputStreamReader(connection.getInputStream()));
			   String line;
			   String result = new String();
			   while ((line = in.readLine())!= null)
			   {
			   result += "\n" + line;
			   }
			   Log.e("aaapt", result);
			   
//	   InputStream   in=connection.getInputStream(); 

	   }   catch   (MalformedURLException   e)   { 
	   //   TODO   Auto-generated   catch   block 
	   e.printStackTrace(); 
	   }   catch   (UnsupportedEncodingException   e)   { 
	   //   TODO   Auto-generated   catch   block 
	   e.printStackTrace(); 
	   }   catch   (IOException   e)   { 
	   //   TODO   Auto-generated   catch   block 
	   e.printStackTrace(); 
	   }
	   Log.e("eeept2", "ees2");
}
 }